.equ PERSON_SIZE,76
.section .data
	str1:
		.string "请输入要修改人的名字>\n"
	str2:
		.string "要修改的联系人不存在\n"
	str3:
		.string "请输入名字>"
	str4:
		.string "联系人名字重复,修改失败\n"
	str5:
		.string "请输入年龄>"
	str6:
		.string "请输入性别>"
	str7:
		.string "请输入电话>"
	str8:
		.string "请输入地址>"
	str9:
		.string "修改成功\n"
	str10:
		.string "%s"
	str11:
		.string "%d"
.section .text
.global ModifyContact
.type ModifyContact,@function
ModifyContact:
	nop
	push %rbp
	mov %rsp,%rbp
	subq $24,%rsp
	mov %rdi,-8(%rbp) #结构体地址	
	mov $0,%rax
	mov $20,%rdi
	call malloc
	test %rax,%rax
	je 1f	
	mov %rax,%r12
	mov $0,%rax
	mov $str1,%rdi
	call printf
#获取用户输入名字
	mov $0,%rax
	mov $str10,%rdi
	mov %r12,%rsi
	call scanf
#查找联系人
	mov -8(%rbp),%rdi
	mov %r12,%rsi
	call FindByName
	cmpl $-1,%eax
	je 2f
	movl %eax,-12(%rbp)
#找到联系人所在堆内存首地址
	mov -12(%rbp),%eax
	imull $PERSON_SIZE,%eax
	movq (%rbx),%r12
	cltq
	addq %rax,%r12 #堆内存首地址
	mov $0,%rax
	#mov $str3,%rdi	
	#call printf
#调用scanf获取用户输入名字		
	#mov $str10,%rdi
	#mov %r12,%rsi
	#call scanf
#获取用户输入年龄
	mov $0,%rax
	mov $str5,%rdi
	call printf
	mov $0,%rax

	movq $str11,%rdi
	leaq 20(%r12),%rsi
	call scanf
#获取用户输入性别
	mov $str6,%rdi
	mov $0,%rax
	call printf

	mov $str10,%rdi
	leaq 24(%r12),%rsi
	call scanf
#获取用户输入电话
	mov $str7,%rdi
	mov $0,%rax
	call printf

	mov $str10,%rdi
	leaq 34(%r12),%rsi
	call scanf
#获取用户输入地址
	mov $str8,%rdi
	mov $0,%rax
	call printf

	mov $str10,%rdi
	leaq 46(%r12),%rsi
	call scanf
1:
	mov $0,%rax	
	mov $str9,%rdi
	call printf
	leaveq 
	retq
2:
	mov $0,%rax
	mov $str2,%rdi
	call printf
	leaveq 
	retq
